import { getLazyTree } from '@/api/base/region';
export default {
  height: 'auto',
  calcHeight: 30,
  tip: false,
  searchShow: true,
  searchMenuSpan: 4,
  searchSpan: 5,
  searchMenuPosition: 'right',
  border: true,
  index: true,
  viewBtn: true,
  selection: true,
  dialogClickModal: false,
  align: 'center',
  indexWidth: 80,
  indexLabel: '编号',
  // menu: false,
  // addBtn: false,
  labelWidth: 145,
  editBtn: false,
  delBtn: false,
  menuWidth: 300,
  column: [
    {
      label: "主键",
      prop: "id",
      type: "input",
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
      hide: true,
      display: false,
    },
    {
      label: "租户ID",
      prop: "tenantId",
      type: "input",
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
      hide: true,
      display: false,
    },
    {
      label: "创建部门",
      prop: "createDept",
      type: "input",
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
      hide: true,
      display: false,
    },
    {
      label: "修改人",
      prop: "updateUser",
      type: "input",
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
      hide: true,
      display: false,
    },
    {
      label: "修改时间",
      prop: "updateTime",
      type: "input",
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
      hide: true,
      display: false,
    },
    {
      label: "是否已删除",
      prop: "isDeleted",
      type: "input",
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
      hide: true,
      display: false,
    },
    {
      label: "姓名",
      prop: "name",
      type: 'input',
      filterable: true,
      overHidden: true,
      rules: [{
        required: true,
        message: "请输入姓名",
        trigger: "blur"
      }],
      search: true,
      slot: true,
    },
    {
      label: "姓名缩写",
      prop: "nameSx",
      type: 'input',
      filterable: true,
      overHidden: true,
      addDisplay: false,
      editDisplay: false,
      viewDisplay: true,
      rules: [{
        required: true,
        message: "请输入姓名缩写",
        trigger: "blur"
      }],
    },
    {
      label: "住院号",
      prop: "zyh",
      type: 'input',
      filterable: true,
      overHidden: true,
      rules: [{
        required: true,
        message: "请输入住院号",
        trigger: "blur"
      }],
      search: true,
    },
    {
      label: "病历号",
      prop: "caseNo",
      type: 'input',
      filterable: true,
      overHidden: true,
      rules: [{
        required: true,
        message: "请输入病例号",
        trigger: "blur"
      }],
    },
    {
      label: "性别",
      prop: "sex",
      type: 'select',
      dicUrl: '/api/blade-system/dict/dictionary?code=sex',
      props: {
        label: 'dictValue',
        value: 'dictKey',
      },
      filterable: true,
      overHidden: true,
    },
    {
      label: "手机号",
      prop: "phone",
      type: 'input',
      filterable: true,
      overHidden: true,
      search: true,
    },
    {
      label: "疾病种类",
      prop: "jbzl",
      type: 'tree',
      dicUrl: '/api/blade-illness/illness/tree',
      props: {
        label: 'title',
        value: 'id',
      },
      filterable: true,
      overHidden: true,

    },

    {
      label: "患者邮箱",
      prop: "mailbox",
      type: 'input',
      filterable: true,
      overHidden: true,
      hide: true,
    },
    {
      label: "身份证号",
      prop: "idCard",
      type: 'input',
      filterable: true,
      overHidden: true,
      hide: true,
    },
    {
      label: "出生日期",
      prop: "birthday",
      type: "date",
      format: 'YYYY-MM-DD',
      valueFormat: 'YYYY-MM-DD'
    },
    {
      label: "民族",
      prop: "mz",
      type: 'input',
      filterable: true,
      overHidden: true,
    },
    {
      label: "现住地",
      prop: "jzd",
      type: "cascader",
      // multiple: true,
      // checkStrictly: true,
      props: {
        labelText: '标题',
        label: 'title',
        value: 'value',
        children: 'children'
      },
      lazy: true,
      viewDisplay: false,
      lazyLoad(node, resolve) {
        const parentCode = (node.level === 0) ? "00" : node.data.id;
        getLazyTree(parentCode).then(res => {    //getLazyTree接口名
          resolve(res.data.data.map(item => {
            return {
              ...item,
              leaf: !item.hasChildren
            }
          }))
        });
      },
      filterable: true,
      overHidden: true,
      hide:true,
    },
    {
      label: "现住地",
      prop: "jzdText",
      type: "input",
      // multiple: true,
      // checkStrictly: true,
      filterable: true,
      overHidden: true,
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
      display:false,
    },
    {
      label: "详细地址",
      prop: "address",
      type: 'textarea',
      minRows: 3,
      maxRows: 5,
      filterable: true,
      overHidden: true,
      hide: true,
      span: 24,
    },
    {
      label: "诊断",
      prop: "diagnosis",
      type: 'textarea',
      minRows: 3,
      maxRows: 5,
      filterable: true,
      overHidden: true,
      hide: true,
      span: 24,
    },
    {
      label: "专病库",
      prop: "type",
      type: 'select',
      dicUrl: '/api/blade-specializeddiseasedb/specializedDiseaseDb/dict',
      dataType: "number",
      props: {
        label: 'value',
        value: 'key',
      },
      search: true,
      filterable: true,
      overHidden: true,
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
    },
    {
      label: '临床资料',
      prop: 'informationList',
      type: 'dynamic',
      span: 24,
      hide: true,
      children: {
        index: false,
        align: 'center',
        type: 'form',
        headerAlign: 'center',
        rowAdd: (done) => {
          // ElMessage.success('新增回调'); // 使用 ElMessage
          done({ input: '默认值' });
        },
        rowDel: (row, done) => {
          // ElMessage.success('删除回调' + JSON.stringify(row)); // 使用 ElMessage
          done();
        },
        column: [
          {
            label: "资料类型",
            prop: "type",
            type: 'select',
            dicUrl: '/api/blade-system/dict-biz/dictionary?code=information_type',
            props: {
              label: 'dictValue',
              value: 'dictKey',
            },
            filterable: true,
            overHidden: true,
          },
          {
            label: "上传文件",
            prop: "link",
            type: 'upload',
            // slot: true,
            dataType: 'string',
            limit: 1,
            fileType: 'doc,docx,xls,xlsx,pdf,txt',
            action: '/blade-resource/oss/endpoint/put-file',
            propsHttp: {
              res: 'data',
              url: 'link',
            },
            slot: true,
            // tip: '只能上传doc/docx/excel文件',
          },
        ]
      }
    }
  ]
}
